<template>
  <!-- <div class="article-item">
    <h2>文章列表项</h2>
  </div> -->
  <van-cell class="article-item">
    <div slot="title" class="title van-multi-ellipsis--13">
      {{ article.title }}
    </div>
    <div slot="label">
      <div class="cover-wrap"
      v-if="article.cover.type === 3"
      >
        <div class="cover-wrap-item"
        v-for="(img,index) in article.cover.images"
        :key="index"
        >
          <van-image
          fig="cover"
          class="image-cover"
          :src="img"
        />
        </div>
      </div>
      <div class="label-wrap">
        <span>作者:{{ article.aut_name }}</span>
        <span>评论数量:{{ article.comm_count }}</span>
        <span>{{ article.pubdate | relativeTime }}</span>
      </div>
    </div>
    <!-- 默认插槽的名字叫做default 也可以删除 -->
    <van-image
    v-if="article.cover.type === 1"
    class="right-cover"
    fig="cover"
    :src="article.cover.images[0]"
  />
  </van-cell>
</template>

<script>
export default {
  // name: ArticleItem
  props: {
    article: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less">
.article-item {
  .title {
    font-size: 0.5rem;
    color: #3a3a3a;
  }
  /deep/ .van-cell__value {
    flex: unset;
    width: 116px;
    height: 73px;
    margin-left: 12px;
  }
  .right-cover {
    width: 3.0rem;
    height: 2.0rem;
  }
  .cover-wrap {
    padding-right:0.5rem 0;
    display: flex;
    .cover-wrap-item {
      flex: 1;
      height: 1.0rem;
      &:not(:last-child) {
        padding-right: 0.1rem;
      }
      .image-cover van-image {
        width: 100%;
        height: 1.0rem;
      }
    }
  }
  .label-wrap {
    font-size: 0.1em;
    color: #b4b4b4;
  }
  .label-wrap span{
    margin-right:0.2rem;
  }
}
</style>
